﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace ATM_Machine
{
    public partial class TakeCash : Form
    {
        static int amount = 0;
        Model model = new Model();
        public TakeCash()
        {
            InitializeComponent();
        }
        public int Amount()
        {
            return amount;
        }
        private void label1_Click(object sender, EventArgs e)
        {

        }

        private void button1_Click(object sender, EventArgs e)
        {
            amount += 50;
            textBox1.Text = amount.ToString();
        }

        private void button2_Click(object sender, EventArgs e)
        {
            amount += 100;
            textBox1.Text = amount.ToString();
        }

        private void button3_Click(object sender, EventArgs e)
        {
            amount += 200;
            textBox1.Text = amount.ToString();
        }

        private void button4_Click(object sender, EventArgs e)
        {
            if (model.takeCash(amount))
            {
                CashTaken ct = new CashTaken(amount);
                ct.Show();
            }
            else
            {
                MessageBox.Show("Önnek nem áll rendelkezésére elegendő fedezete a tranzakcióhoz!");
            }

        }

        private void button5_Click(object sender, EventArgs e)
        {
            this.Close();
        }
    }
}
